89f1de5f4e3f1fe51f430cba2afd5d0903beca91,src/edu/stanford/nlp/trees/TreeGraphNode.java,TreeGraphNode,addArc,#Class#TreeGraphNode#,351
Before Change
if (!treeGraph().equals(node.treeGraph())) {
System.err.println("Warning: you are trying to add an arc from node " + this + " to node " + node + ", but they do not belong to the same TreeGraph!");
}
if (!label.containsKey(arcLabel)) {
label.set(arcLabel, Generics.<TreeGraphNode>newHashSet());
}
return ((Collection) label.get(arcLabel)).add(node);
}
/**
After Change
* @return <code>true</code> iff the arc did not already exist.
*/
@SuppressWarnings("unchecked")
public <GR extends GrammaticalRelationAnnotation> boolean addArc(Class<GR> arcLabel, TreeGraphNode node) {
if (node == null) {
return false;
}
if (!treeGraph().equals(node.treeGraph())) {
System.err.println("Warning: you are trying to add an arc from node " + this + " to node " + node + ", but they do not belong to the same TreeGraph!");
}
Set<TreeGraphNode> collection = label.get(arcLabel);
if (collection == null) {
collection = Generics.<TreeGraphNode>newHashSet();
label.set(arcLabel, collection);
}
return collection.add(node);
}
/**